from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait

from workchat.basetool.basetool import BaseTool
# from workchat.workchat_po.contact_page import  ContactPage
from workchat.workchat_po.contact_page import ContactPage


class AddNumberPage(BaseTool):
    def edit_number_data(self):
        name =(By.ID, "username")
        print(type(name))
        WebDriverWait(self.driver, 10).until(expected_conditions.element_to_be_clickable(name))
        self.driver.find_element(*name).send_keys("张三")
        self.driver.find_element(By.ID, "memberAdd_acctid").send_keys("12222222222")
        self.driver.find_element(By.ID, "memberAdd_phone").send_keys("12222222222")
        self.driver.find_element(By.CSS_SELECTOR,"#js_contacts12 > div > div.member_colRight > div > div:nth-child(4) > div > form > div:nth-child(1) > a.qui_btn.ww_btn.js_btn_save").click()
        return ContactPage()